<?php
if(!$_COOKIE["warabi_admin"]){
	header("Location:index.php");
	exit;
}

include_once('_lib/class.quickskin.php');
include_once('_lib/class.cardlist.php');

$pid = intval($_GET['pid']);
$pid = empty($pid)?0:$pid;
$search_id = $_REQUEST["search_id"];

$newpage = new QuickSkin("tpl/cardlist.html");

$newpage->addtpl("leftmenu" , $addtplPrefix."left.php?type=4");

if(empty($search_id)){
	$newpage->assign('ifshowpid' , "block");
	$newpage->assign('ifshowall' , "none");
}
else{
	$newpage->assign('ifshowpid' , "none");
	$newpage->assign('ifshowall' , "block");
}


$cardlistNum = $cardlist->get_AllCard_Num();
$cardlistArr = $cardlist->get_AllCard_SelectResult($pid , $search_id);

$lpid = floor($cardlistNum/PER_NUM);
$ppid = ($pid-1<0)?0:($pid-1);
$npid = ($pid+1>$lpid)?$lpid:($pid+1);

$newpage->assign( 'gray' , "#DDDDDD");
$newpage->assign( 'firstpage' , 0);
$newpage->assign( 'prevpage' , $ppid);
$newpage->assign( 'nextpage' , $npid);
$newpage->assign( 'lastpage' , $lpid);

$newpage -> assign('cardlist' , $cardlistArr);

$newpage -> output();

?>